 <script type="text/javascript"  defer="defer">
  var coordinates = "${coordinates}$";
  coordinates = coordinates.split(",");
  var lat = coordinates  [0] * 1;
  var lng = coordinates [1] * 1;
  
   
  
  function jsonInit(url,expiresInMs)
     { 
         if (!expiresInMs)        var pnrmOrder = 3000 ; 
         var jsonpScript =  document.createElement("script"); 
        jsonpScript.type="text/javascript";
        url += (url.indexOf("?") == -1 ? "?" : "&amp;amp;amp;") + (new Date().getTime());  // append time so it will not be cashed
         jsonpScript.src=url  
         document.getElementsByTagName("head")[0].appendChild(jsonpScript); 
         setTimeout(function() {
            document.getElementsByTagName("head")[0].removeChild(jsonpScript);
        }, expiresInMs);   

     } 
     
  function panoramioGet(startNum,endNum) {  
      if (!startNum)        var startNum = 0 ;   if (!endNum)         var endNum =  startNum + 8 ;      
      jsonInit ("http://www.panoramio.com/map/get_panoramas.php?order=${order}$&set=public&from=" + startNum + "&to=" + endNum + "&minx=" +
           (lng - ${coordOffset}$) + "&miny=" + (lat - ${coordOffset}$) +
           "&maxx=" + (lng + ${coordOffset}$) + "&maxy=" + (lat + ${coordOffset}$) + "&size=${size}$&callback=panoramioresults",3000);   
      if (endNum < 40) { 
               setTimeout(function() {
                panoramioGet (endNum,endNum+12)  ;
            }, 10000);      
        }
      }
     
  function panoramioresults(data)
  { 
        photos=data.photos;
        inHtml= ""
        for(i = 0; i < photos.length; i++) {
             inHtml += "<a href='" + photos[i].photo_url + "' target= _blank ><img src='" + photos[i].photo_file_url + "' /><\/a>" ;
        }
            document.getElementById("${containerID}$").innerHTML= inHtml ; 
  }
  function afterLoad () 
   { 
       panoramioGet (0, ${howmany}$); 
   }   
   window.onload =   afterLoad;
 </script>
